<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <title>打印导检单</title>
    <base href="<%=basePath %>"/>
    <link rel="stylesheet" href="assets/css/bootstrap.css"/>
    <%--<link rel="stylesheet" href="assets/layui/css/layui.css">--%>
    <script src="assets/js/jquery.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/jquery.validator.min.js"></script>
    <script src="assets/layui/layui.all.js"></script>
    <script src="assets/js/jQuery.print.js"></script>

</head>
<body style="margin:0 auto;text-align:center;">
<!--startprint-->
<div id='ganburenmianbaio' class='WordSection1' style='width:750px;margin:0 auto;text-align:center;vertical-align: middle;'>
    <h1>导检单</h1>
    <p>体检人：${report.user.userName}
        时间：${report.reportTime}
    </p>
    <h3>体检项</h3>
    <table class="table">
        <tr>
            <th style="text-align: center">科室</th>
            <th style="text-align: center">科室地址</th>
            <th style="text-align: center">项目</th>
        </tr>
        <c:forEach items="${report.items}" var="items">
            <tr>
                <td>${items.desk.deskName}</td>
                <td>${items.desk.deskSite}</td>
                <td>${items.itemName}</td>
            </tr>
        </c:forEach>
    </table>
    <p>楼层平面图：</p>
<img src="HospitalFloorPlan.jpg" class="imgsss">
</div>
<!--endprint-->
<a class="btn-primary btn-sm" id='button_print' name='button_print' onclick="printthis()">打印</a>
</body>
<script language="javascript">
    // function printit(){
    //     $("#ganburenmianbaio").print({iframe:true,prepend:'<br/>'});
    // }
    function printthis() {
        bdhtml=window.document.body.innerHTML;//获取当前页的html代码
        sprnstr="<!--startprint-->";//设置打印开始区域
        eprnstr="<!--endprint-->";//设置打印结束区域
        prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+18); //从开始代码向后取html
        prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));//从结束代码向前取html
        window.document.body.innerHTML=prnhtml;
        window.print();
        window.document.body.innerHTML=bdhtml;
    }
</script>
</html>